package com.fitc.weka;

import java.sql.ResultSet;

import com.fitc.json.DatabaseHelper;

import weka.classifiers.misc.HyperPipes;
import weka.classifiers.trees.J48;
import weka.core.Instances;
import weka.experiment.InstanceQuery;

public class ARFFExport {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			InstanceQuery query = new InstanceQuery();
			
			query.setDatabaseURL(DatabaseHelper.url);
			query.setUsername(DatabaseHelper.username);
			query.setPassword(DatabaseHelper.password);
			query.connectToDatabase();
			query.setQuery("select * from images;");
			
		
			
			Instances data = query.retrieveInstances();
			
			 data.setClassIndex(data.numAttributes()- 1);
			
			 String[] options = new String[1];
			 options[0] = "-U";            // unpruned tree
			 HyperPipes tree = new HyperPipes();         // new instance of tree
			 tree.setOptions(options);     // set the options
			 tree.buildClassifier(data);   // build classifier
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		


	}

}
